package tw.com.msig.spring.hibernate.app;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import tw.com.msig.spring.hibernate.entity.User;
import tw.com.msig.spring.hibernate.service.UserService;

public class UserApp {

	public static void main(String[] args) {

		ApplicationContext applicationContext = new ClassPathXmlApplicationContext(
				new String[] { "spring-database.xml", "spring-dao.xml",
						"spring-service.xml" });

		UserService userService = applicationContext.getBean("userService",
				UserService.class);

		List<User> users = userService.getAll();

		for (User user : users) {
			System.out.println(user);
		}

	}

}
